package com.epam.productstore.validation.rules;

import com.epam.productstore.util.ResourceManager;
import com.epam.productstore.validation.ValidationResult;
import com.epam.productstore.validation.ValidationRule;

public class NotEmptyValueRule implements ValidationRule{

	@Override
	public ValidationResult validate(String value) {
		if(value == null || value.trim().isEmpty()){
			String message = ResourceManager.getProperty(ResourceManager.EMPTY_FIELD_MESSAGE);
			return new ValidationResult(false, message);
		} else {
			return new ValidationResult(true, null);
		}
	}
}
